define(
    ["PDAppDir/properties", "PDUtilDir/util", "PDUtilDir/tool", "PDUtilDir/slidebar",
        "PDUtilDir/inputSelect",
        "PDUtilDir/fileupload/multiFileUpload", "Date", "DateCN",
        "css!DateCss"],
    function (Properties, Util, Tool, Slidebar, inputSelect, MFU) {
        function detailSupportInit($scope, $compile) {
            return new detailSupport($scope, $compile);
        }

        function detailSupport($scope, $compile) {
            this.$scope = $scope;
            this.$compile = $compile;
        }

        detailSupport.fn = detailSupport.prototype;
        detailSupport.fn.digest = function () {
            this.$scope.$digest();
        }
        detailSupport.fn.init = function (id, groupName, data) {
            this.entity = $.extend({
                travelGroupId: id,
                groupName: groupName,
                adultNum: 0,
                adultTicketPrice: 0,
                childNum: 0,
                childTicketPrice: 0,
                stuNum: 0,
                stuTicketPrice: 0,
                oldNum: 0,
                oldTicketPrice: 0,
                otherNum: 0,
                otherTicketPrice: 0,
                groupSubsidy: 0,
                groupMoney: 0,
                carCost: 0,
                images: data.images
            }, data.submitAccount);
            this.cache = {
                path: Properties.URL_FILE_SERVER_URL
            }
        }

        detailSupport.fn.run = function (id, groupName) {
            var _this = this;
            $.ajax({
                url: getServer() + "/flea/hclv/submit/account/selectByGroupId.htmls",
                data: {
                    submitAccountId: id
                },
                success: function (data) {
                    if (data.status != 200) {
                        return;
                    }
                    if (data.status == 200 && data.message == 0) {
                        Util.alert("报帐单未上传");
                        return;
                    }
                    _this.init(id, groupName, data.data);

                    _this.slidebars = Slidebar({
                        size: 'lg',
                        url: getServer()
                        + "/static/app/group/guideGroupInfos/views/detail.html",
                        $scope: _this.$scope,
                        $compile: _this.$compile,
                        afterLoad: function ($Panel) {
                            _this.initialization();
                        }
                    });
                }
            });
        };
        detailSupport.fn.initialization = function () {
            var _this = this;
            $.ajax({
                url: getServer() + "/flea/hclv/submit/account/selectLineByTravelGroupId.htmls",
                data: {
                    travelGroupId: _this.entity.travelGroupId
                },
                success: function (dataObject) {
                    _this.entity.lineId = dataObject.data.id;
                    _this.entity.lineName = dataObject.data.name;
                    _this.digest();
                }
            });
        };
        return detailSupportInit;
    });